<template>
  <div v-if="showChangeOrder!=null&&showChangeOrder!=''">
    <el-tooltip effect="light" placement="left" >
      <div slot="content">
        <div
          v-html="showChangeOrder"
          style="max-width:500px;overflow:auto;background: #e1e5e8;font-size: 15px;line-height: 16px;color: #888;max-height: 320px;"
        ></div>
      </div>
      <template >
        <img :src="showChangeOrderPng">
      </template>
    </el-tooltip>
  </div>
</template>

<script>
  import showChangeOrderPng from "@/assets/images/special-1.png";
  export default {
      props: ["row", "data", "more"],
      data() {
        return {
          showChangeOrderPng:showChangeOrderPng,
          showChangeOrder:"",
          orderLockedData:"",
          importerCompanyData:"",
          shipperPersonData:"",
          changeOrderTypeMap: {},
          changeOrderTypeSource:{},
          ChangeImporterCompanySource:{},
          ChangeOrderLockedSource:{},
          ChangeOrderNodeSource:{},
          ChangeShipperPersonSource:{},
          type:"",
        };
      },
    mounted() {
      this.initSpecial();
    },
    methods: {
      initSpecial(){
        console.log("是不是这里的问题", this.$store.state.main.entry);
        if (this.data!=null){
          this.changeOrderTypeMap=this.data["changeOrderField"];
          console.log("改单字段数据:",this.changeOrderTypeMap)
          this.changeOrderTypeSource =  this.$store.state.main.entry.sources["changeOrderTypeSource"];
          this.ChangeImporterCompanySource =  this.$store.state.main.entry.sources["changeImporterCompanySource"];
          this.ChangeOrderLockedSource =  this.$store.state.main.entry.sources["changeOrderLockedSource"];
          this.ChangeOrderNodeSource =  this.$store.state.main.entry.sources["changeOrderNodeSource"];
          this.ChangeShipperPersonSource =  this.$store.state.main.entry.sources["changeShipperPersonSource"];
          for(const key in this.changeOrderTypeMap){
            this.type= this.changeOrderTypeSource[key];
            console.log(this.changeOrderTypeMap)
            if (key=="orderLocked"){
              this.orderLockedData+=this.type+":";
            }
            if (key=="shipperPersonName"){
              this.shipperPersonData+=this.type+":";
            }
            if (key=="importerCompanyName"){
              this.importerCompanyData+=this.type+":";
            }
            if (this.changeOrderTypeMap[key].length>0){
            for (const item in this.changeOrderTypeMap[key]){
              if (key=="orderLocked"){
                //这是客户预报信息
                this.orderLockedData+=this.ChangeOrderLockedSource[this.changeOrderTypeMap[key][item]]+',';
              }
              if (key=="shipperPersonName"){
                //这是发件人信息
                this.shipperPersonData+=this.ChangeShipperPersonSource[this.changeOrderTypeMap[key][item]]+',';
              }
              if (key=="importerCompanyName"){
                //这是进口商
                this.importerCompanyData+=this.ChangeImporterCompanySource[this.changeOrderTypeMap[key][item]]+',';
              }
            }
            }
          }
          this.showChangeOrder=this.orderLockedData+'</br>'+this.shipperPersonData+'</br>'+this.importerCompanyData
          console.log("拼接后的数据:",this.showChangeOrder);
        }
      }
    }
    };
</script>

<style scoped>

</style>
